package cn.smbms.service.impl;

import cn.smbms.dao.ProviderMapper;
import cn.smbms.pojo.Provider;
import cn.smbms.service.ProviderService;
import cn.smbms.utils.PageSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service("providerService")
public class ProviderServiceImpl implements ProviderService {

    @Resource
    private ProviderMapper providerMapper;

    @Override
    public List<Provider> getProviderList(String proCode, String proName, PageSupport pageSupport) {
        try {
            return providerMapper.getProviderList(proCode,proName,pageSupport);
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
    }

    @Override
    public Integer getProviderCount(String proCode, String proName) {
        try {
            return providerMapper.getProviderCount(proCode,proName);
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
    }

    @Override
    public Boolean addProvider(Provider provider) {
        try {
            return providerMapper.addProvider(provider);
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
    }

    @Override
    public Provider getProviderById(Long id) {
        try {
            return providerMapper.getProviderById(id);
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
    }

    @Override
    public Boolean deleteProvider(Long id) {
        try {
            return providerMapper.deleteProvider(id);
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
    }
}
